<?php
if(!session_is_registered("LoginOK"))//bien sessionLoginOK chua ton tai
 	{
 		session_register("LoginOK");
 		$_SESSION['LoginOK'] = 0;
 	}
if(!session_is_registered("UserName"))//bien sessionLoginOK chua ton tai
 	{
 		session_register("UserName");
 		$_SESSION['UserName']="";
 	}
 if(!session_is_registered("Role"))//bien sessionLoginOK chua ton tai
 	{
 		session_register("Role");
 		$_SESSION['Role']=0;
 	}
 
?>


<?php
//PHAN 1: NEU + chua dang nhap  
//			 + dang nhap khong thanh cong'		 THI  the hien form sau
if ($_SESSION['LoginOK'] == 0) { ?>	
 		
<form name="login" action="Common/login.php" method="get" >
<table width="150" border="1">

<tr><td width="100%" height="50" align="center" valign="bottom">LOGIN</td></tr>
		
<tr><td>UserName: <input type="text" name="fUserName" size="18" maxlength="40"></td></tr>
	
<tr><td>Password: <input type="password" name="fUserPass" size="20" maxlength="40"></td></tr>
		
<tr><td align="left">
	<a href="signup.php">Sign Up</a>   |   
	<input type="submit" name="btnsubmit" value="login" size="5"></td></tr>

<tr><td align="center"></td></tr>

<tr><td width="150" height="20" align="center" valign="bottom"></td></tr>
		
</table>
</form>

<?php } else { ?>

<?php
// PHAN 2: NGUOC LAI NEU dang nhap thanh cong voi quyen nguoi dung
//	           THI	the hien doan ma sau 
if ($_SESSION['LoginOK'] > 0) { 
?>	
<table width="150" border="1">
 
<tr><td width="150" height="50" align="center" valign="bottom" >LOGIN</td></tr>

<tr><td align="center"><?php echo $_SESSION['UserName'];?> .Have a nice day!</td></tr>

<tr><td><hr><a href="signup.php">Sign Up</a> | <a href="Common/logout.php"> Exit</a></td></tr>

</table>

<?php } ?>

<?php } ?>

